﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Globalization;
using System.Collections;


namespace woolbrush
{
    public partial class BrushForm : Form
    {
        private bool getHosted = false;
        private Array addressArray = null;
        public BrushForm()
        {
            InitializeComponent();
            InitBrushForm();
        }

        private void BrushForm_Load(object sender, EventArgs e)
        {
            //1 创建一个webbrower，访问infitech.com.cn/i，页面加载后读取文本，准备访问
            MyWebAdapt mwa = new MyWebAdapt(this.listBox1, "infitech.com.cn/i",true);
            mwa.StartNavigate();
        }

        private void InitBrushForm()
        {
            this.browserArray = new WebBrowser[10];
            this.browserArray[0] = new WebBrowser();
            SetDefaultStyle(this.browserArray[0]);

        }

        private void SetDefaultStyle(WebBrowser wb)
        {
            /*
            wb.Visible = false;
            wb.Size.Height = 0;
            wb.Size.Width = 0;
            */
        }

        private void button1_Click(object sender, EventArgs e)
        {

            //this.backgroundWorker1.RunWorkerAsync(this);
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
        delegate void SetDetailText(string text);
        void MySetDetailText(string text)
        {
            if (this.detail.InvokeRequired)
            {
                SetDetailText sdt = new SetDetailText(MySetDetailText);
                this.Invoke(sdt, new object[] { text });
            }
            else
            {
                this.detail.Text = text;
            }
            
        }
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker bw = (BackgroundWorker)sender;
            this.MySetDetailText("adc");
        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                button1_Click((object)this.button1, new EventArgs());
            }
        }

    }
}